import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router);
import home from '@/pages/home'
import index from '@/pages/index'
import product from '@/pages/product'
const cart = () => import('@/pages/cart')
// import cart from '@/pages/cart'
const detail = () => import('@/pages/detail')
// import detail from '@/pages/detail'
const login = () => import('@/pages/login')
import order from '@/pages/order'
import orderList from '@/pages/orderList'
import orderConfirm from '@/pages/orderConfirm'
import orderPay from '@/pages/orderPay'
import aliPay from '@/pages/aliPay'

const routes = [
    {
        path:'/',name:'home',redirect:'/index',component:home,children:[
            {path:'/index',name:'index',component:index},
            {path:'/product/:id',name:'product',component:product},
            {path:'/detail/:id',name:'detail',component:detail}
        ]
    },
    {
        path:'/login',name:'login',component:login
    },
    {
        path:'/cart',name:'cart',component:cart
    },
    {
        path:'/order',name:'order',component:order,children:[
            {path:'list',name:'list',component:orderList},
            {path:'orderConfirm',name:'orderconfirm',component:orderConfirm},
            {path:'orderPay',name:'orderpay',component:orderPay},
            {path:'aliPay',name:'alipay',component:aliPay}
        ]
    }
]

const router = new Router({
    routes
})


export default router